﻿using System.Threading.Tasks;

namespace Sidvall.IdentityManager.Net.SimpleServices.V1
{
	public partial class Plugin
	{
		#region Public Members

		#region InitializeAsync

		public async Task InitializeAsync()
		{
			System.Type type;
			IPlugin pluginInstance;

			type = Sidvall.SystemContext.Current.TypeCache.GetType(this.TypeName);
			pluginInstance = Sidvall.SystemContext.Current.CodeManager.CreateInstance(type) as IPlugin;
			if (pluginInstance != null)
			{
				await pluginInstance.InitializeAsync(this.Context);
			}
		}

		#endregion

		#endregion
	}
}